package jp.co.cyberagent.android.gpuvideo;

import android.content.Context;
import android.media.MediaPlayer;
import android.util.AttributeSet;

import androidx.annotation.NonNull;

/**
 * @author wenjie
 */
public class GPUVideoMediaView extends GPUVideoView {
    public GPUVideoMediaView(Context context) {
        super(context);
    }

    public GPUVideoMediaView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setDataSource(@NonNull MediaPlayer mediaPlayer) {
        gpuVideo.getRenderer().setOnSurfaceCreateListener(mediaPlayer::setSurface);
        mediaPlayer.setOnVideoSizeChangedListener(gpuVideo.getRenderer());
        gpuVideo.setUpMedia();
    }
}
